﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;

namespace BookExpress.DB
{
    public class ServicosDB
    {
        private SqlConnection conn;

        public ServicosDB()
        {
            SqlConnectionStringBuilder sb = new SqlConnectionStringBuilder();
            sb.DataSource = ".\\SQLEXPRESS";
            sb.UserID = "adm";
            sb.Password = "adm";
            sb.InitialCatalog = "bookexpress";

            conn = new SqlConnection(sb.ToString());
        }

        public SqlDataReader recordSet(string strCmd)
        {
            conn.Open();
            SqlCommand cmd = new SqlCommand(strCmd, conn);
            return cmd.ExecuteReader();
        }

        public void executar(string strCmd)
        {
            conn.Open();
            SqlCommand cmd = new SqlCommand(strCmd, conn);
            cmd.ExecuteNonQuery();
        }
    }
}